#pragma once

#include "RBTree.h"

namespace TEST2
{
	template<class K>
	class set
	{
	public:
		struct GetNum;
		typedef typename RBTree<K, const K, GetNum>::iterator iterator;

		pair<iterator, bool> insert(const K& key)
		{
			return _tree.insert(key, getnum);
		}

		void inorder()
		{
			_tree.inOrder(getnum);
		}

		iterator begin()
		{
			return _tree.begin();
		}

		iterator end()
		{
			return _tree.end();
		}

	private:
		struct GetNum
		{
			const K& operator() (const K& key)
			{
				return key;
			}
		};
	private:
		RBTree<K, const K, GetNum> _tree;
		GetNum getnum;
	};

	void Test1()
	{
		int num[] = { 4, 1, 3, 7, 10, 9, 8 };
		set<int> hash;
		for (auto& i : num)
			hash.insert(i);

		//hash.inorder();
		for (auto& i : hash)
			cout << i << endl;
	}
}
